package api.java.lang.invoke;

public class MyData {

	private String fname;
	private String lname;
	private int age;
	protected int score;

	public MyData() {

	}

	public MyData(int age) {
		this();
		this.age = age;
	}

	public String getFname() {
		return fname;
	}

	public void setFname(String fname) {
		this.fname = fname;
	}

	public String getLname() {
		return lname;
	}

	public void setLname(String lname) {
		this.lname = lname;
	}

	public int getAge() {
		return age;
	}

	public String join(String delimiter, String... args) {
		if (args != null) {
			return String.join(delimiter, args);
		}
		return "";
	}

	public int sum(int a, int b, int c, int d) {
		return a + b + c + d;
	}

	public String valueToString(int v) {
		return "I:" + v;
	}

	public String valueToString(Integer v) {
		return "Integer:" + v;
	}

	public String valueToString(long v) {
		return "L:" + v;
	}

	public String valueToString(double v) {
		return "D:" + (long) v;
	}

	protected String plus(int a, int b) {
		return "plus:" + (a + b);
	}

	@SuppressWarnings("unused")
	private String mod(int a, int b) {
		return "mod:" + (a % b);
	}

	public static int[] arrayOfTow(int a, int b) {
		return new int[] { a, b };
	}

	public static int plus(int a, int[] other) {
		if (other != null) {
			for (int n : other) {
				a += n;
			}
		}
		return a;
	}

	public static String plus2(int a, int b) {
		return "plus:" + (a + b);
	}

	public static int twice(int a) {
		return a * 2;
	}

	public static class WData extends MyData {

		@Override
		public String valueToString(int v) {
			return "int:" + v;
		}
	}
}
